class Solution(object):
    def minRectanglesToCoverPoints(self, points, w):
        """
        :type points: List[List[int]]
        :type w: int
        :rtype: int
        """
        # 暂时没什么思路
        # 其实只需要看x轴，毕竟只要看最小的矩形的数目
        # 将所有的X轴的参数抽离出来
        points_x = list(map(lambda x: x[0], points))
        # print(points_x)
        points_x_sorted = sorted(points_x)  # 升序处理一下
        # 然后不断框选和判断
        res = 0
        if len(points_x_sorted) != 0:
            res = 1
        right_bound = points_x_sorted[0] + w

        for i in range(len(points_x_sorted)):
            if points_x_sorted[i] <= right_bound:
                continue
            else:
                right_bound = points_x_sorted[i] + w
                res += 1
        return res


if __name__ == '__main__':
    solution = Solution()
    points = [[2,3],[1,2]]
    print(solution.minRectanglesToCoverPoints(points, 0))
